/*
 * Contains interface for banks official sites currency rates data analysis
 */
package rates_analysis;

import generated_entities.Rates;
import generated_entities.Templates;
import javax.ejb.Local;

/**
 * Class for banks official sites currency rates data analysis
 * @author Alexey Akimov <frinatella@gmail.com>
 */
@Local
public interface RatesAnalyzerSessionBeanLocal {
    
    /**
     * Tests URL connection
     * @param bankInRegion which rates page url will be tested
     * @throws rates_analysis.RatesAnalysisException if urlString could not be parsed  or IO error happened
     */
    public void testURL(generated_entities.BanksInRegions bankInRegion) throws rates_analysis.RatesAnalysisException;
    
    /**
     * Extracts rates values specified by template regexps and bank in region url
     * @param template record with regexp and bank in region  url for rates extract
     * @return Rates record with extracted rates
     * @throws RatesAnalysisException if urlString could not be parsed  or IO error happened
     */
    public Rates extractRatesForTemplate(Templates template) throws RatesAnalysisException ;
    
    /**
     * Extracts rates values specified by template regexps and bank in region  url and save it into db
     * @param template record with regexp and bank in region  url for rates extract
     * @return Rates record with extracted rates
     * @throws RatesAnalysisException  if urlString could not be parsed, IO error happened, null or not Double number returned by regexp search 
     */
    public Rates updateRatesForTemplate(Templates template) throws RatesAnalysisException ;
    
    /**
     * Extract rates values specified by existing templates in db
     * @return errors count
     */
    public int updateRates();

    /**
     * Extract rates values specified by existing templates in db
     * Scheduled
     */
    public void updateRatesScheduled();

}
